# _*_ coding: UTF-8 _*_
# @Time     : 2021/10/25 15:04
# @Author   : Gong Yangyi
# @Site     : http://www.hzdledu.cn/
# @File     : prac.py
# @Software : PyCharm

# 1.获取字符串 '11:12:11> 001 enter chatroom, level2'中的用户id和等级
str1='11:12:11> 001 enter chatroom, level2'
print(str1[10:13])
print(str1[30:])
# 2.获取下面字符串中的所有用户id和等级
# '''11:12:11> 001 enter chatroom, level2
# 11:12:11> 22 enter chatroom, level3
# 11:12:11> 0004 enter chatroom, level105
# 11:12:11> 003 enter chatroom, level99
# '''
str1 = '''11:12:11> 001 enter chatroom, level2
11:12:11> 22 enter chatroom, level3
11:12:11> 0004 enter chatroom, level105
11:12:11> 003 enter chatroom, level99'''
list1 = str1.split('\n')
# print(list1)
for i in range(len(list1)):
    if list1[i]:
        list1[i] = list1[i].split()
    print(list1[i][1], list1[i][4])
# print(list1

# 3.将字符串'abcd[0910efg&*(]hijkl[ada2r4545]mn03opq$st'中的非字母字符去掉
str1='abcd[0910efg&*(]hijkl[ada2r4545]mn03opq$st'
str2=''
for i in str1:
    if i.isalpha():
        str2 +=i
print(str2)
# 5.编写一个程序，要求用户输入一个字符串，将字符串中重复的字符串去除，如输入'abcaadef'，输出为'abcdef'
str1=input('请输入一个字符串:')
set1=set(str1)
str2=''.join(list(set1))
print(str2)

str3=''
for i in str1:
    if  i not in str3:
        str3+=1
print(str3)